1. Field
One embodiment of the present invention relates to a magnetic disk apparatus that has a cache memory for caching write commands, and to a method of controlling such a magnetic disk apparatus.
2. Description of the Related Art
Various magnetic disk apparatuses, each comprising a cache memory to increase the access speed, have been developed in recent years (see, for example, Jpn. Pat. Appln. KOKAI Publication No. 6-309234, paragraphs 0002 to 0005). The cache memory is a high-speed buffer storage device that temporarily stores data exchanged between a host computer and a magnetic disk apparatus. It stores a copied part of the data recoded on a magnetic disk. Cache memories usually used are high-speed semiconductor memories such as SRAMs or DRAMs.
In a magnetic disk apparatus having a cache memory, a write command and data are temporarily stored in the cache memory (write cache) when the host computer issues a write-access request to the magnetic disk apparatus. The cache memory can register (queue) many commands. The number of commands the cache memory can register is limited, nonetheless. The write commands stored in the cache memory must therefore be written on the magnetic disk (write flush). In most cases, the data is written on the disk when the write-flush request is issued from the host computer. Alternatively, even if no write-flush requests have been issued from the host computer, the magnetic disk apparatus may determine how busy the data processing is, and the contents of the cache memory may be written on the disk while the data processing is not busy.
If a cache memory is so used in the magnetic disk apparatus, the number of times the mechanical driving is performed to access the magnetic disk apparatus will decrease. This can indeed greatly increase the apparent speed of accessing the magnetic disk apparatus. However, the mechanical driving must be performed to accomplish the write-flush. Consequently, the time required for accessing the magnetic disk apparatus cannot be shorted so much as is desired. It takes about tens of milliseconds to write-flush one write command.